{% extends 'base.html' %}

{% block top_content %}
{% endblock %}

{% block main_content %}
<div class="gcb-main">
  <div class="gcb-article tab-content">
    <div class="gcb-aside">
      <h2>Student Profile for {{ student.key().name() }}</h2>

      {% if student %}
      <table style="border-collapse:collapse;">
      <tr><td><b>Currently enrolled</b></td><td>{{ student.is_enrolled }}</td></tr>
      <tr><td><b>Date enrolled</b></td><td>{{ student.enrolled_date }}</td></tr>
      <tr><td><b>Email</b></td><td>{{ student.key().name() }}</td></tr>
      <tr><td><b>Name</b></td><td>{{ student.name }}</td></tr>
      <tr><td colspan=2><b>Assessment scores</b></td></tr>
      <tr><td>&nbsp;&nbsp;&nbsp;<b>Pre-class</b></td><td>
        {% if scores.has_key('precourse') %}
          Completed</td></tr>
        {% endif %}
      <tr><td>&nbsp;&nbsp;&nbsp;<b>Mid-class</b></td><td>
        {% if scores.has_key('midcourse') %}
          {{ scores['midcourse'] }}</td></tr>
        {% endif %}
      <tr><td>&nbsp;&nbsp;&nbsp;<b>Post-class</b></td><td>
        {% if scores.has_key('postcourse') %}
          {{ scores['postcourse'] }}</td></tr>
        {% endif %}
      <tr><td><b>Overall course score</b></td><td>
        {% if scores.has_key('overall_score') %}
          {{ scores['overall_score'] }}</td></tr>
        {% endif %}
      </table>

      <form action='student/editstudent' method='post'>
        <h2><label for="name">New Name</label></h2>
        <fieldset style="border: none;">
          <p><input name="name" type="text" size="40">
            <input type="hidden" name="email" value="{{ student.key().name() }}"></p>
        </fieldset>
        <p><button class="gcb-button" type="submit">Save Changes</button> &nbsp;&nbsp;&nbsp;
          <a href="student/home" class="gcb-button" type="submit">Cancel</a></p>
      </form>

      <h2>To leave the course permanently, click on Unenroll</h2>

      <p><a href="student/unenroll" class="gcb-button" type="submit">Unenroll</a></p>

      {% else %}
      <p>Student profile not found ...</p>
      {% endif %}
    </div>
  </div>
</div>

{% endblock %}

